package com.example.demo;

import com.example.demo.repo.LdapService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.ldap.repository.config.EnableLdapRepositories;

@Slf4j
@EnableLdapRepositories
@SpringBootApplication
public class DemoApplication implements CommandLineRunner {

    public static void main(String[] args) {
        System.setProperty("com.sun.jndi.ldap.object.disableEndpointIdentification", "true");
        SpringApplication.run(DemoApplication.class, args);
    }


    @Autowired
    private LdapService ldapService;
    @Override
    public void run(String... args) throws Exception {
        ldapService.queryAll1();
//        ldapService.addOU("我的测试","ou=测试中,ou=股份测试");//添加组织
        ldapService.addUser("测试人员","测试密码","ou=测试中,ou=测试测试股份");
    }
}
